<?php
function send_mail($primary_contact_email){
    $html='Dear '.$primary_contact_name.',<br/><br/>';
    $html.='Thank you for your recent online reservation! We have you booked and confirmed for the following Trip:<div style="padding-left:100px;"><h1 style="font-size:20px;">'.$trip_info['title'].'</h1></div>';
    $html.='Your flight Departs ';
    $html.=$dep_time!="-"?'at '.$dep_time:''; 
    $html.=' on '.$dep_date.' and Returns ';
    $html.=$ret_time!="-"?'at '.$ret_time:''; 
    $html.=' on '.$ret_date.'. The seat(s) reserved are for the following passengers:<br/><br/>';
    $html.='<div style="padding-left:100px;">'.$passengers_names.'</div><br/>';
    $html.='Please note the Max Cargo Weight allowed per passenger on this flight is '.$max_cpp.'.<br/><br/>';
    $html.='<div style="padding-left:100px;"><table cellspacing="0" cellpadding="0">';
    $html.='<tr><td style="" valign="top" align="left">Total Airfare:</td><td style="" valign="top" align="left">$'.$airfare.'</td></tr>';
    $html.='<tr><td style="width:300px;" valign="top" align="left">Discount Applied:</td><td valign="top" align="left">$'.($airfare!="0.00"?$summary_discount:"0.00").'</td></tr>';
    $html.='<tr><td>Tax (FET):</td><td valign="top" align="left">$'.$tax.'</td></tr>';
    $html.='<tr><td style="border-bottom:#000000 1px solid;width:300px;" valign="top" align="left">Segment Fees:</td><td style="border-bottom:#000000 1px solid;" valign="top" align="left">$'.$segements_fees.'</td></tr>';
    $html.='<tr><td style="width:300px;font-weight:bold;" valign="top" align="left">TOTAL:</td><td style="font-weight:bold;" valign="top" align="left">$'.$full_price.'</td></tr>';
    $html.='</table></div><br/>';
    $html.='<table cellspacing="0" cellpadding="0">';
    $html.='<tr><td style="width:400px;" valign="top" align="left">Gift Code Applied:<br/><br/></td><td valign="top" align="left">$'.$full_price.'<br/><br/></td></tr>';
    $html.='<tr><td style="width:400px;" valign="top" align="left">Amount Billed to your Credit Card:</td><td valign="top" align="left">$'.$price.'<br/></td></tr>';
    $html.='<tr><td style="width:400px;" valign="top" align="left">Credit Card Authorization Code:</td><td valign="top" align="left">#'.$parsedXML['AuthCode'].'<br/></td></tr>';
    $html.='<tr><td style="width:400px;" valign="top" align="left">Credit Card Holders Name:</td><td valign="top" align="left">'.$_POST['cc_name_on_the_card'].'<br/></td></tr>';
    $html.='<tr><td style="width:400px;" valign="top" align="left">Credit Card Number:</td><td valign="top" align="left">XXXX-XXXX-XXXX-'.$cc_name_on_the_card_last.'<br/></td></tr>';
    $html.='</table><br/>';
    $html.='Please download/read/print our Trip Information Packet that covers CIA policies for your records:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>';
    $html.='<a href="http://www.flightstothechannelislands.com/documents/FTTCI_Confirmation.pdf">DOWNLOAD</a><br/><br/>';
    $html.='If you have any questions or concerns, please contact the CIA Flight Desk via:<br/><br/>';
    $html.='<div style="padding-left:100px;"><span style="margin-right:33px;">Phone: </span>(805) 987-1301 x "0"<br/><span style="margin-right:30px;">E-mail: </span><a href="mailto:islands@flycia.com">islands@flycia.com</a></div><br/>';
    $html.='Thank you for choosing to fly with Channel Islands Aviation!<br/><br/>Flight Desk<br/>Channel Islands Aviation, Inc.<br/><a href="http://www.flycia.com">www.flycia.com</a><br/><img src="http://www.flightstothechannelislands.com/images/cia_logo.png" />';
    
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= "From: \"Channel Islands Aviation\" <booking@flightstothechannelislands.com>\r\n";
    $headers .= "Bcc: islands@flycia.com\r\n";
    $headers .= "Content-type: text/html; charset=utf-8\r\n";
    $headers .= "Content-Transfer-Encoding: 8bit\r\n";
    $subject="CIA Islands Flight Confirmation";
     mail($primary_contact_email,$subject,$html,$headers);
     }
     $primary_contact_email = 'home7519@yandex.ru';
     send_mail($primary_contact_email);
      

?>
